package sort;

import static net.ftng.commons.lang.utils.MathUtils.randomLong;
import static net.ftng.commons.lang.utils.PrintUtils.println;
import net.ftng.commons.lang.Monitor;
import net.ftng.commons.lang.utils.MonitorUtils;
import net.ftng.commons.lang.utils.SortUtils;

import org.junit.Test;

public class SortTest {

    @Test
    public void performance() {

        int size = 200;
        // performance divide line: 200
        println("Array size:%s", size);
        Long[] array = new Long[size];
        for (int i = 0; i < size; i++) {
            array[i] = randomLong(size);
        }

        Monitor monitor = MonitorUtils.getMonitor(this.getClass().getSimpleName(), "performance");
        monitor.start();
        SortUtils.asc(array);
        monitor.stopAndprintResult("By SortUtils.asc");

        monitor.start();
        MergeSort.sort(array);
        monitor.stopAndprintResult("By MergeSort.");

        monitor.start();
        BubbleSort.sort(array);
        monitor.stopAndprintResult("By BubbleSort.");
    }
}
